package com.itlong.cloud.POJO.VO.jd;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.itlong.cloud.enumerate.jd.JDCodEnum;
import lombok.Data;
import lombok.NoArgsConstructor;


/**
 * jd业务 函数返回值对象
 *
 * @craeteDate 2020/08/03
 */
@Data
@NoArgsConstructor
public class JDResultVO {
    String id;

    Integer code;

    String message;

    Long timestamp;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    Object params;

    /** 自定义错误码及数据集的响应结果
     */
    public JDResultVO(String id, Integer code,Object params){
        super();
        this.setId(id);
        this.setCode(code);
        this.setMessage(JDCodEnum.getByCode(code));
        this.setTimestamp(System.currentTimeMillis());
        this.setParams(params);
    }
    /** 自定义错误码及数据集的响应结果
     */
    public JDResultVO(Integer code,Object params){
        super();
        this.setCode(code);
        this.setMessage(JDCodEnum.getByCode(code));
        this.setTimestamp(System.currentTimeMillis());
        this.setParams(params);
    }
    /** 自定义错误码及数据集的响应结果
     */
    public JDResultVO(String id, Integer code){
        super();
        this.setId(id);
        this.setCode(code);
        this.setMessage(JDCodEnum.getByCode(code));
        this.setTimestamp(System.currentTimeMillis());

    }

    /** 自定义错误码及数据集的响应结果
     */
    public JDResultVO(Integer code){
        this.setCode(code);
        this.setMessage(JDCodEnum.getByCode(code));
        this.setTimestamp(System.currentTimeMillis());
    }

    /** 自定义错误码及数据集的响应结果
     */
    public JDResultVO(Integer code, String message){
        super();
        this.setCode(code);
        this.setMessage(message);
        this.setTimestamp(System.currentTimeMillis());

    }

}
